<%@page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*,java.text.*"%>
<%@ page import="java.text.SimpleDateFormat, java.util.Date,java.util.*,kines.ct.*"%>
<%@ include file="../Connections/ConsorcioSQL7.jsp" %>
<%@include file="../utils/validarSession.jsp" %>
<%
NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2); 

String Siglas = (String) request.getParameter("cvedesarrollo");
Development desarrollo = Development.getData( Siglas );
String FraccName = desarrollo.getName( );
%>
<HTML>
<HEAD>
<TITLE>Reportes - Concentrado Por Precio</TITLE>
<META HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT">
<link rel="stylesheet" type="text/css" href="../css/arastyle.css">
<SCRIPT language=JavaScript src="../utils/menu/milonic_src.js" type=text/javascript></SCRIPT>	
<script	language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=../utils/menu/mmenuns4.js><\/scr"+"ipt>");		
  else _d.write("<scr"+"ipt language=JavaScript src=../utils/menu/mmenudom.js><\/scr"+"ipt>"); 
</script>
<%@ include file="../utils/menu/menu_data_inside.jsp" %>
<style type="text/css">
<!--
.style3 {color: #000000}
.style4 {color: #FFFFFF}
.style5 {
	font-size: 14px;
	font-weight: bold;
}
.style7 {
	color: #CCCCCC;
	font-size: 14;
	font-weight: bold;
}
.style8 {font-size: 12px}
.style9 {color: #FFFFFF; font-size: 12px; }
-->
</style>
</HEAD>
<BODY class="fondo">
<FORM METHOD=post ACTION="concentrado_precio.jsp" NAME="ConcentradoPorPrecio_Rep">
  <table width="70%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr bgcolor=#663300>
    <td colspan="3"><div align="center" class="style3"><span class="style4"><span class="style5">REPORTE POR PRECIO DE VENTA </span><br>
          <span class="style7"><%=FraccName.toUpperCase()%> </span></span></div></td>
    </tr>
  <tr bgcolor="#CCCCCC">
    <td width="32%" height="33"><div align="right"><strong>Desarrollo:</strong></div></td>
    <td width="34%"><a name="inicio"></a><select onChange="this.form.submit();" name="cvedesarrollo" class="textfields" <%out.print(!session.getAttribute("Nivel_Acceso").equals("17") && !session.getAttribute("Nivel_Acceso").equals("18") && !session.getAttribute("Nivel_Acceso").equals("19")?"":"disabled");%>>
					<%=Development.getHtmlCombo( Siglas )%>
    				</select>
      <span class="style19">
      <%
		if( session.getAttribute("Nivel_Acceso").equals("17") || session.getAttribute("Nivel_Acceso").equals("18") || session.getAttribute("Nivel_Acceso").equals("19") ){
			out.println("<input type=\"hidden\" name=\"cvedesarrollo\" value=\""+Siglas+"\">");
		}
		%>
      </span></td>
    <td width="34%"><div align="right"><img src="../images/transparent.gif" border="0" name="ReportesInsideImg" id="ReportesInsideImg"><a href="javascript:popup('ReportesInside','ReportesInsideImg')" onMouseOut="popdown()"><strong>OTROS REPORTES</strong></a></div></td>
  </tr>
</table>
<br>
<table width="80%" border="0" cellspacing="2" cellpadding="2" bgcolor="#FFFFFF" align="center">
	<tr bgcolor=#663300> 
		<td width="5%" align="center" class="style4 style8">#</td>        
		<td align="center" class="style9" >PrecioXmt2</td>
		<td align="center" class="style9">No Lotes </td>
		<td align="center" class="style9">SuperficieXLotes</td>
		<td align="center" class="style9">Venta Total</td>
		<td align="center" class="style9">%Por Precio </td>
	</tr>
	<%
	Object [] objs_reporte = Development.getConcentradoPrecio( Siglas );
	String str_noLotes = "";
	int int_noLotes;
	int int_noLotesTotal = 0;
	
	String str_porcentajes = "";
	double dbl_porcentajes;
	double dbl_porcentajesTotal = 0;
	
	String str_precios = "";
	double dbl_precios;
	double dbl_preciosTotal = 0;
	
	double dbl_mtrs;
	double dbl_mtrsTotal = 0;
	
	double dbl_ventaTotal;
	double dbl_ventaTotalTotal = 0;
	
	if( objs_reporte != null ){
		for( int int_i = 0; int_i < objs_reporte.length; int_i++ ){
			Object [] objs_campos = (Object [])objs_reporte[int_i];
			
			dbl_precios = ((Double)objs_campos[0]).doubleValue();
			str_precios += (str_noLotes.equals("") ? "" : "," ) + nf.format( dbl_precios ).replaceAll( ",", "" ) + "%";
			dbl_preciosTotal += dbl_precios;
			
			int_noLotes = ((Integer)objs_campos[1]).intValue();
			str_noLotes += (str_noLotes.equals("") ? "" : "," ) + int_noLotes;
			int_noLotesTotal += int_noLotes;
			
			dbl_porcentajes = ((Double)objs_campos[4]).doubleValue();
			str_porcentajes += (str_porcentajes.equals("") ? "" : "," ) +nf.format( dbl_porcentajes ).replaceAll( ",", "" )+ "%";
			dbl_porcentajesTotal += dbl_porcentajes;
			
			dbl_mtrs = ((Double)objs_campos[2]).doubleValue();
			dbl_mtrsTotal += dbl_mtrs;
			
			dbl_ventaTotal = ((Double)objs_campos[3]).doubleValue();
			dbl_ventaTotalTotal += dbl_ventaTotal;
			
			out.println("<tr bgcolor=\"#FFFFFF\" align=\"center\">");
			out.println("	<td width=\"5%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">"+(int_i+1)+"</font></td>");
			out.println("	<td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>"+nf.format( dbl_precios )+"</b></font></td>");
			out.println("	<td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">"+int_noLotes+"</font></td>");
			out.println("	<td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">"+nf.format( dbl_mtrs )+" </font><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"-2\">mt</font><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">2</font></td>");
			out.println("	<td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">$ "+nf.format( dbl_ventaTotal )+"</font></td>");
			out.println("	<td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">"+nf.format( dbl_porcentajes )+"%</font></td>");
			out.println("</tr>");
		}
	}
	%>
	<tr bgcolor="#663300"> 
		<td width="5%" align="center" class="style9">Totales</td>
		<td align="center" class="style9"><%out.print(nf.format(dbl_preciosTotal));%></td>
		<td align="center" class="style9"><%out.print(int_noLotesTotal);%></td>
		<td align="center" class="style9"><%out.print(nf.format(dbl_mtrsTotal));%>&nbsp;mt2</td>
		<td align="center" class="style9">$ <%out.print(nf.format(dbl_ventaTotalTotal));%></td>
		<td align="center" class="style9">100.00%</td>
	</tr>
</table>
</div>
</FORM>
<div align="center"><br>
    <applet code=com.objectplanet.chart.BarChartApplet width=700 height=250 align="middle" archive=/ct/utils/chart.jar viewastext>
      <param name=sampleValues value="<%out.print(str_noLotes);%>">
      <param name=sampleLabels value="<%out.print(str_porcentajes);%>">
      <param name=barLabels value="<%out.print(str_precios);%>">
      <param name=multiColorOn value=true>
      <param name=barLabelsOn value=true>
      <param name=barLabelAngle value="270">
      <param name=barLabelStyle value="below_and_floating">
      <param name=rangeAxisLabel value="No Lotes">
      <param name=rangeAxisLabelAngle value="270">
      <param name=rangeAxisLabelFont value="Arial, normal, 12">
      <param name=background value="white">
    </applet>
  </DIV>
</BODY>
</HTML>
